<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>switch语句</title>
		<script>
			/*使用switch实现判断年龄
			var age=38;
			switch(true){
				case age>17&&age<=30:
					 alert("你已经成年了");
					 break;
				case age>30&&age<=60:
					 alert("你已经中年了");
					 break;
				case age>60:
					 alert("你已经退休了");
					 break;
				default:
					 alert("你还是个小孩");
			}
			*/
			//Date().getDay()用来获取当前是星期几
			var days=new Date().getDay();
			switch(days){
				case 0:
					alert("今天是星期日");
					break;
				case 1:
					alert("今天是星期一");
					break;
				case 2:
					alert("今天是星期二");
					break;
				case 3:
					alert("今天是星期三");
					break;
				case 4:
					alert("今天是星期四");
					break;
				case 5:
					alert("今天是星期五");
					break;
				case 6:
					alert("今天是星期六");
					break;
			}
		</script>
	</head>
	<body>
	</body>
</html>
